package mspbots.next.ticket.core.data.rejects;

import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import reactor.core.publisher.Flux;

/**
 * @author Alex bob(https://github.com/vnobo)
 * @date Created by 2019/8/30
 */
public interface RejectRepository extends R2dbcRepository<Reject, Long> {

    /**
     * Get tenant reject newest entity.
     *
     * @param tenantId tenant id
     * @return reject all data
     */
    @Query("SELECT * from next_ticket_reject WHERE tenant_id = :tenantId and reject_time > now()")
    Flux<Reject> findNewest(Long tenantId);
}
